package service;

import dao.PetDao;

import dao.PetDaoOracleImpl;
import entity.pet;
import jakarta.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

@Service("PetService")
public class PetServiceImpl implements PetService {
    //    PetDao petDao= PetDaoFactory.getInstance(PetDaoFactory.defaultBeanName);
//    @Qualifier("petDaoMySQL")
//    @Autowired(required = false)
//    @Resource(name = "petDaoMySQL")
    @Resource(type = PetDaoOracleImpl.class)
    private PetDao petDao;



    public void setPetDao(PetDao petDao) {
        this.petDao = petDao;
    }

    @Override
    public boolean save(pet pet) {
        return petDao.insert(pet) > 0;
    }
}